package util.methods;

// TODO: this parser requires spaces, e.g. -p4 doesn't work. 
public class CommandLineParser {
	
	public static boolean hasOption(String[] args, String name)
	{
		for (int i = 0;  i < args.length;  i++)
			if (args[i].equals(name)) 
				return true;
		return false;
	}

	public static String getOption(String[] args, String name)
	{
		for (int i = 0;  i < args.length;  i++)
			if (args[i].equals(name) && i+1 < args.length) 
				return args[i+1];

		return null;
	}

	public static String getOption2(String[] args, String name)
	{
		for (int i = 0;  i < args.length;  i++)
			if (args[i].equals(name) && i+2 < args.length) 
				return args[i+2];
		return null;
	}
}
